<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>slibc: slibc/stdio_templates_.hpp Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />



</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">slibc
   
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="dir_4d4a740b65ecc1faa3510c186d2f00c5.html">slibc</a>      </li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="headertitle">
<div class="title">stdio_templates_.hpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="stdio__templates___8hpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* Copyright (C) 2011-2012 SBA Research gGmbh</span>
<a name="l00002"></a>00002 <span class="comment"></span>
<a name="l00003"></a>00003 <span class="comment">   This file is part of the Slibc Library.</span>
<a name="l00004"></a>00004 <span class="comment"></span>
<a name="l00005"></a>00005 <span class="comment">   The Slibc Library is free software; you can redistribute it and/or</span>
<a name="l00006"></a>00006 <span class="comment">   modify it under the terms of the GNU Lesser General Public</span>
<a name="l00007"></a>00007 <span class="comment">   License as published by the Free Software Foundation; either</span>
<a name="l00008"></a>00008 <span class="comment">   version 2.1 of the License, or (at your option) any later version.</span>
<a name="l00009"></a>00009 <span class="comment"></span>
<a name="l00010"></a>00010 <span class="comment">   The Slibc library is distributed in the hope that it will be useful,</span>
<a name="l00011"></a>00011 <span class="comment">   but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00012"></a>00012 <span class="comment">   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU</span>
<a name="l00013"></a>00013 <span class="comment">   Lesser General Public License for more details.</span>
<a name="l00014"></a>00014 <span class="comment"></span>
<a name="l00015"></a>00015 <span class="comment">   You should have received a copy of the GNU Lesser General Public</span>
<a name="l00016"></a>00016 <span class="comment">   License along with the Slibc Library; if not, see</span>
<a name="l00017"></a>00017 <span class="comment">   &lt;http://www.gnu.org/licenses/&gt;.  </span>
<a name="l00018"></a>00018 <span class="comment">*/</span>
<a name="l00027"></a>00027 <span class="preprocessor">#ifndef SLIBC_STDIO_TEMPLATES_HPP</span>
<a name="l00028"></a>00028 <span class="preprocessor"></span><span class="preprocessor">#define SLIBC_STDIO_TEMPLATES_HPP</span>
<a name="l00029"></a>00029 <span class="preprocessor"></span>
<a name="l00030"></a>00030 <span class="preprocessor">#include &quot;<a class="code" href="stdio_8h.html" title="Contains those _s-functions that are related to stdio.">./stdio.h</a>&quot;</span>
<a name="l00031"></a>00031 <span class="preprocessor">#include &lt;stdarg.h&gt;</span>
<a name="l00032"></a>00032 
<a name="l00048"></a><a class="code" href="stdio__templates___8hpp.html#a38b68ddc37d97863a3e6a3cb62a2c082">00048</a> <span class="keyword">template</span>&lt;r<span class="keywordtype">size_t</span> n&gt; <span class="keywordtype">int</span> <a class="code" href="stdio_8h.html#ab23abdde72205874b2fb1dbd62d3f420" title="This function allows fomatted output into buffer s while taking into account its size.">sprintf_s</a>(<span class="keywordtype">char</span> (&amp;s1)[n], 
<a name="l00049"></a>00049                                                                   <span class="keyword">const</span> <span class="keywordtype">char</span> * restrict format, ...) 
<a name="l00050"></a>00050 {
<a name="l00051"></a>00051   va_list arg;
<a name="l00052"></a>00052   va_start(arg, format);
<a name="l00053"></a>00053   <span class="keywordtype">int</span> r = <a class="code" href="stdio_8h.html#a3ff3ddc4dfd8d6853dda4441b8fdf2bc" title="The vsprintf_s function is equivalent to sprintf_s but expects a va_list argument.">vsprintf_s</a>(s1, n, format, arg);
<a name="l00054"></a>00054   va_end(arg);
<a name="l00055"></a>00055   <span class="keywordflow">return</span> r; 
<a name="l00056"></a>00056 }
<a name="l00057"></a>00057 
<a name="l00058"></a>00058 
<a name="l00075"></a><a class="code" href="stdio__templates___8hpp.html#ad0c89f9e0392dc9c6158ccd6ee6c3261">00075</a> <span class="keyword">template</span>&lt;r<span class="keywordtype">size_t</span> n&gt; <span class="keywordtype">int</span> <a class="code" href="stdio_8h.html#a4772e3cf6be186e274cfb571ecc2a12e" title="This function allows fomatted output into buffer s while taking into account its size.">snprintf_s</a>(<span class="keywordtype">char</span> (&amp;s1)[n], 
<a name="l00076"></a>00076                                                                   <span class="keyword">const</span> <span class="keywordtype">char</span> * restrict format, ...) 
<a name="l00077"></a>00077 {
<a name="l00078"></a>00078   va_list arg;
<a name="l00079"></a>00079   va_start(arg, format);
<a name="l00080"></a>00080   <span class="keywordtype">int</span> r = <a class="code" href="stdio_8h.html#acebd989cc77ba725898eeab88bb5c83e" title="The vsnprintf_s function is equivalent to snprintf_s but expects a va_list argument.">vsnprintf_s</a>(s1, n, format, arg);
<a name="l00081"></a>00081   va_end(arg);
<a name="l00082"></a>00082   <span class="keywordflow">return</span> r; 
<a name="l00083"></a>00083 }
<a name="l00084"></a>00084 
<a name="l00085"></a>00085 <span class="preprocessor">#endif</span>
</pre></div></div><!-- contents -->


<hr class="footer"/><address class="footer"><small>
Generated on Wed Oct 31 2012 13:48:20 for slibc by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>

</body>
</html>
